package org.realteam.example.action;

import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.realteam.example.model.TestBean;
import org.realteam.example.service.ExampleManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;

/**
 * @author Harry
 * @version 1.0 Created On：2011-12-23 下午8:30:22
 */

@Controller
public class ExampleAction extends ActionSupport {

	private static final long serialVersionUID = 1L;

	private static final Logger logger = Logger.getLogger(ExampleAction.class.getName());

	@Autowired
	protected ExampleManager exampleManager;

	@Action("exampleAction")
	public String example() throws Exception {
		// TestBean bean = new TestBean();
		// bean.setName("Jack");
		// exampleManager.updateObject(bean);
		//
		// TestBean bean1 = new TestBean();
		// bean.setName("Jack1");
		// exampleManager.updateObjectInNewTransaction(bean1);
		//
		// List<TestBean> list = new ArrayList<TestBean>();
		// for (int i = 0; i < 5; i++) {
		// TestBean bean2 = new TestBean();
		// bean.setName("Jack" + i);
		// list.add(bean2);
		// }
		//
		// exampleManager.batchUpdateObject(list);
		//
		// exampleManager.doBizWithNoTransaction();

		Object o = exampleManager.load("2c90bcbd346af85101346af97fd20000", TestBean.class);
		
		Object o1 = exampleManager.load0("2c90bcbd346af85101346af97fd20000", TestBean.class);

		logger.info("In input method of class Register");

		return INPUT;

	}

}
